﻿@model IEnumerable<ShenLanCMS.Models.AdType>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<fieldset>
    <legend>@Html.ActionLink("广告管理", "index", "ad") | 类型管理 @Html.ActionLink("添加", "create")</legend>
    <br />
    <table>
        <tr>
            <th>
                类型名称
            </th>
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.TypeName)
                </td>
                <td>
                    @Html.ActionLink("编辑", "Edit", new { id = item.AdTypeID }) |
                    <a href="javascript:deladtype('@item.AdTypeID')">删除</a>
                </td>
            </tr>
        }
    </table>
</fieldset>
<script type="text/jscript">
    function deladtype(obj) {
        if (confirm("确定要删除该分类吗?")) {
            $.post("/adtype/delete/" + obj, function (data) {
                alert(data);
                if (data == "删除成功")
                    window.location.reload();
            });
        }
    }
</script>